package test.baojia.act.business;

import com.alibaba.fastjson.JSONObject;
import org.openqa.selenium.WebDriver;

import java.util.Map;
import java.util.Properties;

/**
 * 简易批量执行脚本测试，模板context直接去Test Json的context。
 */
public class SimpleBatchTestJsonBusiness extends Business {

    @Override
    public void run(JSONObject context, WebDriver driver, Properties resource, JSONObject parentContext)throws  Exception  {
        super.run(context, driver, resource, parentContext);
        JSONObject templateContext = this.makeTestJsonTemplateContext();
        final String templateName = this.makeTestJsonTemplateName();
        this.runTestJson(templateName, templateContext , this.driver , this.resource , templateContext);
    }

    protected JSONObject makeTestJsonTemplateContext(){
        return this.context;
    }

    protected String makeTestJsonTemplateName(){
        return this.context.getString("business");
    }
}